//
//  OtherManager.m
//  17DianYing
//
//  Created by apple on 15/9/14.
//  Copyright (c) 2015年 apple. All rights reserved.
//

#import "OtherManager.h"
#import "AFNetworking.h"

@interface OtherManager ()

@property(nonatomic,strong)AFHTTPRequestOperationManager *afManager;
@property (nonatomic,strong)OtherManager *getManager;

@end

@implementation OtherManager





+(instancetype)share
{
    static OtherManager *m = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        m = [[OtherManager alloc]init];
    });
    return m;
}

-(void)getSelfWithID:(NSString *)selfid  BlockHoudle:(GetSelfManagerBlock)hb
{
    self.afManager = [[AFHTTPRequestOperationManager alloc]init];
    self.afManager.responseSerializer = [AFHTTPResponseSerializer serializer];
    
    NSString * url =[http stringByAppendingString:@"/mobile/user/getCustomUserInfo"];
    
    NSDictionary * dic =  @{@"userId":selfid};
    AFHTTPRequestOperation *op = [self.afManager GET:url parameters:dic success:^(AFHTTPRequestOperation *operation, id responseObject) {
        id obj = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
        NSDictionary *dic = obj;
        hb(dic);
        NSLog(@"%@",dic);
        [op start];
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"%@",error.localizedDescription);
    }];
    
    
}
@end
